// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose:  .
//   $Id$

class CImplSelection;
struct ISelectionChild
{

public:
	//Called by a selection to see if the value it has
	//	is compatible with the items it contains.
	//--------------Obsolete-----------------------
	//virtual bool checkValue(BSTR const sVal) = 0;
	
	//if a selection has no initial value, or its
	//	value is incompatible with the items, 
	//	the specified behaviour is to set the value
	//	to the first value of its items.
	//------This is no longer the case.--------
	//virtual void getFirstValue(BSTR * psVal) = 0;

	//Draw is called by the selection object on 
	//	initialise.  This ensures that the child
	//	objects are all inserted in the correct order.
	//	Thus preventing any errors where children of 
	//	choices elements are created before the choices
	//	element, or just that the order on screen
	//	differs from the order in the code.
	virtual HRESULT draw(BSTR const sDrawInside) = 0;

	//To allow deep descendents to communicate with the 
	//	selection at the top.
	virtual CImplSelection * GetOwnerSelection() = 0;

	//to allow a select to refer to a selection child
	//	by index.
	virtual void SetSelectionIndex(long lIndex) = 0;

	//Called to inform the child that it has been selected
	virtual void select(const long lIndex) = 0;
	virtual void deselect() = 0;
	virtual void selectFrom(CList<VARIANT, VARIANT> &lstNodes, CStringW & sList) = 0;
	virtual HRESULT redraw() = 0;

};
//Allows objects that resolve to CResolvedItems to find 
//	a container to put them in.
class CResolvedItemList;
struct IResolvedItemContainer
{
public:
	virtual CResolvedItemList * GetResolvedItemList() = 0;
};

class IItemWithCaption
{
public:
	//Called by CImplCaption::refresh().  This will tell
	//	the control that contains it that there is a new 
	//	caption.  The control can decide what to do with
	//	it, possibly consider some kind of deferred
	//	processing, or maybe just push it onto the UI.
	virtual HRESULT onCaptionValueChange(BSTR sCaption) = 0;
	virtual HRESULT detachCaption() = 0;
	virtual ~IItemWithCaption(){};

};

class IItemWithAlert
{
public:
	// Called by CImplAlert::refresh, tells the containing control
	// that there is a new alert.
	virtual HRESULT onAlertValueChange(BSTR sAlert) = 0;
	virtual HRESULT detachAlert() = 0;
	virtual ~IItemWithAlert(){};
};

struct IItemWithUICommon
	: public IItemWithCaption
	, public IItemWithAlert
{
	//Probably won't contain much, but may do, 
	//	only really here as a placeholder.
	//(help|hint|alert|Action)*
};

